/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package cn.pconline.activity.util;

import java.util.Random;

/**
 *
 * @author pc
 */
public class RandomUtils {

    /**
     * 
     * @param max   
     * @param count     ����
     * @return
     */
    public static int[] random(int max, int count) {
        Random random = new Random();
        int[] result = new int[count];       //
        int i = 0;
        while (i < count) {
            boolean flag = false;
            int m = random.nextInt(max);
            for (int t : result) {
                if (m == t) {
                    flag = true;
                    break;
                }
            }
            if (!flag) {
                result[i] = m;
                i++;
            }
        }
        return result;
    }

}
